<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>进销存报表</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic}/common/change/change.js"></script>
	<script type="text/javascript">
	$(document).ready(function() {
		initVaccName(stockAndSalesList.companyCode,stockAndSalesList.vaccineId);
		$(".vaccineCompany").change(function(){
			initCompanyName($(this).val());
		});
		$(document).on("click","#btnReset",function(){
			$("#cType").val("").select2();
			$("#vaccineId").val("").select2();
			$("#batchNo").val("");
			$("#beginDate").val("");
			$("#endDate").val("");
		})
	});
	function down(){
		top.$.jBox.confirm("确认要导出疫苗进销存明细数据吗？","系统提示",function(v,h,f){
			if(v=="ok"){
				$("#searchForm").attr("action","${ctx}/area/vaccinate/stockAndSalesDetailListExport");
				$("#searchForm").submit();
			}
			$("#searchForm").attr("action","${ctx}/area/vaccinate/stockAndSalesDetailList");
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	}
	var stockAndSalesList = JSON.parse('${fns:toJson(stockAndSalesList)}');
	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
    	return false;
    }
	</script>
	<style type="text/css">		
		#contentTable td ,#contentTable th{
			text-align: center;
		}
		#contentTable{
		    padding:1px 4px;
		    width: 99%;
		}
		#contentTable tbody tr td{
			font-size: 13px;
		}
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="#">疫苗进销存明细列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="stockAndSalesList" action="${ctx}/area/vaccinate/stockAndSalesDetailList" method="post" class="breadcrumb form-search ">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input id="id" name="id" type="hidden" value="${stockAndSalesList.id}"/>
		<input id="code" name="code" type="hidden" value="${stockAndSalesList.code}"/>
		<input id="storeCode" name="storeCode" type="hidden" value="${stockAndSalesList.storeCode}"/>
		<input id="sellPrice" name="sellPrice" type="hidden" value="${stockAndSalesList.sellPrice}"/>
		<input id="beginDate" name="beginDate" type="hidden" value="<fmt:formatDate value="${stockAndSalesList.beginDate}" pattern="yyyy-MM-dd"/>"/>
		<input id="endDate" name="endDate" type="hidden" value="<fmt:formatDate value="${stockAndSalesList.endDate}" pattern="yyyy-MM-dd"/>"/>
		<input id="newDate" name="newDate" type="hidden" value="<fmt:formatDate value="${stockAndSalesList.newDate}" pattern="yyyy-MM-dd"/>"/>
		<input id="oldDate" name="oldDate" type="hidden" value="<fmt:formatDate value="${stockAndSalesList.oldDate}" pattern="yyyy-MM-dd"/>"/>
		<div class="breadcrumb">
			<table class="table table-bordered">
				<tr>
			   	    <th>疫苗类型：</th>
					<td>
						<form:select path="cType" id="cType" class="span2 minWidth" readonly="true" disabled="true">
							<form:option value="" label="--请选择--"/>
							<form:options items="${fns:getDictList('bs_vaccineInfo_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select> 
					</td>
					<th>疫苗名称:</th>
					<td>
						<form:select path="vaccineId" id="vaccineId" class="span2 minWidth vaccineCompany" readonly="true" disabled="true">
						</form:select>
					</td>
					<th>生产企业：</th>
					<td>
						<form:select path="companyCode" id="companyCode" class="span2 minWidth changeCompany" readonly="true" disabled="true">
						    <form:option value="" label="--请选择--"/> 
						</form:select>
					</td>
				</tr>
				<tr>
					<th>起始日期：</th>
					<td>
						<input id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate" readonly="readonly" disabled="disabled"
							value="<fmt:formatDate value="${stockAndSalesList.beginDate}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
					</td>
					<th>截止日期：</th>
					<td>
						<input id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate" readonly="readonly" disabled="disabled"
							value="<fmt:formatDate value="${stockAndSalesList.endDate}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
					</td>
				    <th>疫苗批号：</th>
					<td>
						<form:input path="batchNo" id="batchNo" class="span2 minWidth" readonly="true" disabled="true"/>
					</td>
				</tr>
			</table>
		</div>
		<!-- <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<input id="btnReset" type="button" class="btn btn-primary" value="重置"/> -->
		<input onclick="down()" class="btn btn-primary" type="button" value="导出"/> 
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>编号</th>
				<th>出入库类型</th>
				<th>订单号</th>
				<th>供货单位</th>
				<th>收货单位</th>
				<th>时间</th>
				<th>数量</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="sas"  begin="0"  varStatus="status">
			<tr>
				<td>
					${(page.pageNo-1)*page.pageSize+status.index+1 }
				</td>
				<td> 
				    ${sas.type}
				</td>
				<td> ${sas.orderNo} </td>
				<td> ${sas.supplyorgName} </td>
				<td> ${sas.receiveorgName} </td>
				<td>
					<fmt:formatDate value="${sas.createDate}" pattern="yyyy-MM-dd"/>  
				</td>
				<td> ${sas.num} </td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>